package com.tmall.qatest.notifymocker.controller;

import com.taobao.dpservice.domain.order.OrderReadOptionDO;
import com.taobao.dpservice.domain.order.SubPurchaseOrderDO;
import com.taobao.dpservice.notify.client.SubPurchaseOrderMsgDO;
import com.taobao.dpservice.result.ResultBaseDO;
import com.taobao.dpservice.service.PurchaseOrderReadService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

/**
 * Created with IntelliJ IDEA.
 * User: cangfeng.mxf
 * Date: 13-2-26
 * Time: 下午2:30
 * To change this template use File | Settings | File Templates.
 */
@Controller
@RequestMapping(method = RequestMethod.POST,params = "/dpc")
public class DpcMessageController {
    @RequestMapping("/create.do")
    public ModelAndView createOrder(
            @RequestParam(required = true, value = "order_id") String subPurchaseOrderId
    ) {
        OrderReadOptionDO option = new OrderReadOptionDO();
        //需要包含主单、物流以及买家留言信息
        option.setIncludeMainOrder(true);
        option.setIncludeLogistics(true);
        option.setIncludeBuyerMessage(true);
        SubPurchaseOrderDO result =
                (purchaseOrderReadService.getSubOrderById(Long.parseLong(subPurchaseOrderId), option))
                .getModule();
        //自己组装SubPurchaseOrderMsgDO
        SubPurchaseOrderMsgDO msg = new SubPurchaseOrderMsgDO();
        msg.setAddress();

        ModelAndView mav = new ModelAndView("dpc_create", "dpcSubPurchaseOrderDO", );
        return mav;

    }
}
